﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Cms.Core.Application.IService;
using Cms.Core.AspNetMvc.Mvc;
using Cms.Core.AspNetMvc.Mvc.Filter;
using Cms.Core.Infrastructure;
using Cms.Core.Infrastructure.Ui;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace Cms.Core.Web.Controllers
{
 
    /// <summary>
    /// 审计信息接口
    /// </summary>
    [Display("审计信息")]
    [DisableAuditing]
    public class AuditController : WebApiController
    {
        private IAuditService _auditService = null;

        public AuditController(IAuditService auditService)
        {
            _auditService = auditService;
        }

        /// <summary>
        /// 异步得到审计分页数据
        /// </summary>
        /// <param name="requestData"></param>
        /// <returns></returns>
        [Display("异步得到审计分页数据"), HttpPost, CommonPermission]
        public async Task<PageData> GetAuditPageDataAsync([FromBody]PageRequestData requestData)
        {

            var pageData = await _auditService.GetAuditLogPageDataAsync(requestData);
            return pageData.ToPageData();
        }
    }
}